<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
//1.具名函数
function fn1 () {
  console.log('具名函数')
}

fn1()

//2.匿名函数(鸿蒙里面不支持这种写法)
//无法绑定this指向
const  fn2 =function (){
    console .log ('匿名函数')
}
fn2()


//3.箭头函数
let fn3 = () => {
  console.log('箭头函数')
}

fn3()

// 4.剩余参数，参数默认值
       function eatFood(f1, f2 = '剁椒鱼头', ...foods) {
      // 剩余参数必须是最后一个
     
      }

       eatFood('西兰花', '鸡蛋', '榴莲排骨汤')   
          //'西兰花', '剁椒鱼头', '榴莲排骨汤'
       eatFood('西兰花')    
    //有默认值的话,无论给不给  都会打印出来

    </script>
</body>
</html>